package com.woniuxy.java102vuecli.controller;

import com.woniuxy.java102vuecli.entity.Student;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author author
 * @Create 2023-09-13 15:51
 */
//@CrossOrigin
@RestController
@RequestMapping("/student")
public class StudentController {

    @RequestMapping("/get/all")
    public ResponseResult<List<Student>> getAllStudents(){
        List<Student> students=new ArrayList<>();
        students.add(new Student(1,"zs","2000-1-1","cd"));
        students.add(new Student(2,"ls","2000-1-1","cd"));
        students.add(new Student(3,"ww","2000-1-1","cd"));

        return new ResponseResult<List<Student>>(200,"ok",students);
    }

    @RequestMapping("/get/add")
    public ResponseResult<Void> addStudents(){
        new ResponseResult<List<Student>>(200,"ok",null);
        ResponseResult.<String>builder().code(200).msg("success").data("xxx").build();
        ResponseResult.ok();
        ResponseResult r=ResponseResult.SUCCESS;
        ResponseResult.ok("abc");
        return ResponseResult.SUCCESS;
    }
}
